import com.guigu.www.Service.ClassService;
import com.guigu.www.Service.StudentService;
import com.guigu.www.pojo.Class;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.HashMap;

public class t {
    @Test
    public void t1(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService bean = applicationContext.getBean(StudentService.class);
        HashMap<String, String> map = new HashMap<>();
        PageVo<Student> studentPageVo =bean.pageStu(map);
        System.out.println(studentPageVo);
    }
    @Test
    public void t2(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService bean = applicationContext.getBean(StudentService.class);
        Student student = new Student(null,"娜娜",2,"女","2002-07-23","null","431321200207233748","123556955","12323@wee.cww","湖南",null,null);
        bean.insert(student);
    }
    @Test
    public void t3() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService bean = applicationContext.getBean(StudentService.class);
        Student student = bean.selectByPrimaryKey(8);
        System.out.println(student);
    }
    @Test
    public void t4(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService bean = applicationContext.getBean(StudentService.class);
        Student student = new Student(8,"cc",2,"女","2002-07-23","null","431321200207233748","123556955","12323@wee.cww","湖南",null,null);
        bean.updateByPrimaryKey(student);
    }
    @Test
    public void t5(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        ClassService bean = applicationContext.getBean(ClassService.class);
        PageVo<Class> classPage = bean.findClassPage(null, 1, 3);
        System.out.println(classPage);
    }
}
